
function value=expornd(lambda)

% generates an exponentially distributed random number with the mean */
% equal to 1/lambda 

  done=1;

  while done==1;
  ran= rand(1);
     if ran ~=0
     done=0;
     end
  end


  value = - log(ran)/lambda;

